<%--
 *  @Author: Kevinfan
 *  Date:    2010/3/2
 *
 *  Copyright (C) 2000 - 2012 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.PurchaseChannel");
  String strModuleName = "ERM";
  String contextPath = request.getContextPath();
%>
<% //--------------------  include files list --%>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<%int LangNums = ConstantProp.multiLangNumber;%>
<html>
<head>
<title>PurchaseChannel</title>
<PageFlow:CheckPageFlow pageName="p_zylstockchannel"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/Calendar.js"></script>
<script language="JavaScript">

function page_back(){
	parent.location.href="DoctorSummary.jsp?<%= OvalTools.randomURL()%>";
}

function page_add()
{
  if(!checkALLElems(document.getElementById("newdetail"))) return;
  cform.actionname.value = "add";
  cform.target = "_self";
  isRunning = true;
  document.cform.submit();
}

function page_delete()
{
  if(isNullChecked(cform.deleteids)) 
  {
    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
    return;
  }
  if(!confirm('<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>'))
     return;
  cform.actionname.value = "delete";
  cform.target = "_self";
  isRunning = true;
  document.cform.submit();
}

function page_setOrg4(id,name,code)
{
  document.cform.purchasechannelid.value = id;
  document.cform.purchasechannelcode.value = code;  
  document.cform.purchasechannelname.value = name;
  var remote = window.open("","newwindow");
  if (remote != null)
    remote.close();
}

function page_allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var alldatafile = document.getElementsByName('deleteids');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = false;
		}	
	}
}
</script>
</head>
<%
String strDisplayFlag="";
if(request.getParameter("displayflag")!=null)
{
  strDisplayFlag=request.getParameter("displayflag");
}
%>
<iframe name="reloadHandler" style="display:none" ></iframe>
<body>
<table width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td class="summary_top"></td>
  </tr>
</table>
<table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0">
  <form id="pageform" name="cform" method="post" action="/oval/Dispatcher" >
  <input type="hidden" name="pagename" value="p_zylstockchannel">
  <input type="hidden" name="actionname">
  <custom:hidden property="hospitalid"/>
		<tr class="deepblue-left"> 
		  	<%if(!(strDisplayFlag).equals("view")){%>
		  	<td width="4%" class="title_center"><input type="checkbox" name="allcheck" class="normalradio" onclick="page_allcheckselect();"></td>
          	<%} %>
          	<td  class="title_center"><%= label.getLabelName("L_StockChanel") %></td>
	  	</tr>
      	  <%
            Vector summary = (Vector)pageContext.getAttribute("totalsummary");
            if(summary == null)
              summary = new Vector();
            int i=1;
            int org =0;;
            String strClassType="none";
          %>
          <logic:iterate id="info" collection="<%= summary %>" >
          <%
          	HashMap PSMap = (HashMap)pageContext.getAttribute("info");
            Integer oColIndexLang=new Integer(i);
            if(i%2==0)
              strClassType="td-listrom";
            else
              strClassType="none";
            i++;
          %>
         <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull(strClassType)%>'"  class="<%=JspHelper.filterNull(strClassType)%>"> 
            <%if(!(strDisplayFlag).equals("view")){%>
            <td class="title_center"> 
              	<input type="checkbox" name="deleteids" id="deleteids<%=JspHelper.filterNull(i-1)%>" value="<custom:write name="info" property="stockchannelid"/>" class="normalradio" />
            </td>
            <%} %>
            <td class="td_center"><custom:write name="info" property="purchasechannelname" nbsp="true"/></td>
          </tr>
          </logic:iterate>
          <input type="hidden" name="nums" value="<%=JspHelper.filterNull(summary.size())%>">
          <input type="hidden" name="numrows" value="<%=LangNums*(JspHelper.filterNull(summary.size())+1)%>">
          <%if(!(strDisplayFlag).equals("view")){%>
          <span id="newdetail">
          <tr class="none"> 
          	<td>&nbsp;</td>          
            <td>                       
            	<custom:hidden property="purchasechannelid" name="hospitaldetail" />
            	<custom:text property="purchasechannelcode" name="hospitaldetail" command="notnull" label="L_StockChanel" readonly="true"/>
            	<a onclick="popup('<%=contextPath %>/masterdata/ogm/OrgSelect.jsp?<%= OvalTools.randomURL() %>&flag=pchannel&globalpccode=112','newwindow','height=450, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no')"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
            	<custom:text property="purchasechannelname" name="hospitaldetail" command="notnull" label="L_StockChanel" readonly="ture"/>
            </td>
          </tr>
          </span>
          <%} %>
  </form>
</table>
	<%if(!(strDisplayFlag).equals("view")){%>
	<table width="100%" cellspacing="0" cellpadding="0">
		<tr>
			<td class="summary_top"></td>
		</tr>
		<tr>
			<td class="td_center">
			<a onclick="javascript:page_add();"><custom:button type="2" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a>
			<a onclick="javascript:page_delete();"><custom:button type="2" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>	
			</td>	
		</tr>
	</table>
	<%} %>
</body>
</html>